﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MVC.DAL;
using MVC.Common;

namespace MVC.BLL
{
    public class EmployeeBLL
    {
        EmployeeDAL dal;
        public void Save(string empName, string addr, int deptid)
        {
            EmployeeDTO empDTO = new EmployeeDTO()
            {
                Name = empName,
                Address = addr,
                Department = new DepartmentDTO()
                {
                    DeptId = deptid
                }
            };
            dal = new EmployeeDAL();
            dal.Save(empDTO);
        }

        public List<EmployeeDTO> GetAllEmployeeDetail()
        {
            dal = new EmployeeDAL();
            try
            {
                return dal.GetAllEmployeeDetail();
            }
            catch(Exception ex)
            {
                return new List<EmployeeDTO>();
            }
        }
    }
}
